﻿namespace SLClient.Resource.Converters
{
    using SLClient.Extension;
    using SLClient.ServiceAPI;
    using System;
    using System.Globalization;
    using System.Linq;
    using System.Windows.Data;

    public class IntToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int bankId = (int) value;
            return Enumerable.FirstOrDefault<BankInfo>(ViewDispatcher.Banks,
                new Func<BankInfo, bool>((s) => { return s.Id == bankId; })).Name;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}

